<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const arrObj = [{ a: 'a' }, { b: 'b' }, { c: 'c' }]
      const obj = { name: 'wmj' }

      for (const key in arrObj) {
        console.log('[ key ]-19', key)
      }

      for (const key in obj) {
        console.log('[ key ]-23', key)
      }

      for (const key of arrObj) {
        console.log('[ key ]-31', key)
      }

      //! 不能使用
      /*      for (const key of obj) {
        console.log('[ key ]-30', key)
      } */

      //? for of不能对 对象用
      //?  forin拿到对象的key值或下标
      //?   forof拿到的是迭代对象
    </script>
  </body>
</html>
